<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <title></title>
	<link rel="stylesheet" type="text/css" href="${path}/css/main.css">
	<link rel="stylesheet" type="text/css" href="${path}/css/mainTable.css">
	<script type="text/javascript">
		function removeConfigFilter(id, province, sp_number){
			if(confirm("删除后无法恢复!你确定要删除吗?")){
				var actionUrl = "${path}/configFilter/deleteConfigFilter.action";
				var params = "configFilterVo.id="+id+"&configFilterVo.province="+province+"&configFilterVo.sp_number="+sp_number;
				params = encodeURI(params);
				params = encodeURI(params);
				window.location.href=actionUrl+'?'+params;
			}
		}
		
		function removeLowerConfigFilter(lower_id, province){
			if(confirm("删除后无法恢复!你确定要删除吗?")){
				var actionUrl = "${path}/configFilter/deleteLowerConfigFilter.action";
				var params = "configFilterVo.lower_id="+lower_id+"&configFilterVo.province="+province;
				params = encodeURI(params);
				params = encodeURI(params);
				window.location.href=actionUrl+'?'+params;
			}
		}
	</script>
  </head>
  <body>
    <div>
    	<p>新增渠道扣量配置<a href="${path }/configFilter/addConfigFilter.action" title="添加渠道扣量">添加</a></p>
    	<div>
    		<table>
    			<thead>
    				<tr>
    					<th>编号</th>
    					<th>渠道名称</th>
    					<th>扣量省份</th>
    					<th>业务长号码</th>
    					<th>扣量比例(百分比)</th>
    					<th>开始时间</th>
    					<th>结束时间</th>
    					<th>长号码操作</th>
    					<th>渠道操作</th>
    				</tr>
    			</thead>
    			<c:choose>
    				<c:when test="${configFilterMapVoList != null && fn:length(configFilterMapVoList) > 0}">
    					<c:forEach var="configFilterMapVo" items="${configFilterMapVoList }" varStatus="list">
    						<c:if test="${configFilterMapVo.configFilterVoList != null && fn:length(configFilterMapVo.configFilterVoList) > 0 }">
    							<c:forEach var="configFilterVo" items="${configFilterMapVo.configFilterVoList }" varStatus="i">
    								<c:choose>
    									<c:when test="${i.index == 0 }">
    										<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }">
    											<td rowspan="${fn:length(configFilterMapVo.configFilterVoList) }">${list.index + 1 }</td>
    											<td rowspan="${fn:length(configFilterMapVo.configFilterVoList) }">
				    								<a href="${path }/configFilter/modifyLowerConfigFilter.action?configFilterVo.lower_id=${configFilterMapVo.lower_id }&configFilterVo.province=${configFilterMapVo.province }">${configFilterMapVo.lower_name }</a>
				    							</td>
				    							<td rowspan="${fn:length(configFilterMapVo.configFilterVoList) }">
				    								<c:choose>
				    									<c:when test="${configFilterMapVo.province != '' }">
				    										${configFilterMapVo.province }
				    									</c:when>
				    									<c:otherwise>
				    										全部
				    									</c:otherwise>
				    								</c:choose>
				    							</td>
				    							<td>
				    								<a href="${path }/configFilter/modifyConfigFilter.action?configFilterVo.id=${configFilterVo.id }">${configFilterVo.sp_number }</a>
				    							</td>
				    							<td>${configFilterVo.num }</td>
				    							<td>${configFilterVo.start_time }</td>
				    							<td>${configFilterVo.end_time }</td>
				    							<td>
				    								<a href="javascript:removeConfigFilter(${configFilterVo.id },'${configFilterVo.province }','${configFilterVo.sp_number }');">删除</a>
				    							</td>
				    							<td rowspan="${fn:length(limitBusinessMapVo.limitBusinessVoList) }">
				    								<a href="javascript:removeLowerConfigFilter(${configFilterMapVo.lower_id },'${configFilterMapVo.province }');">删除</a>
				    							</td>
    										</tr>
    									</c:when>
    									<c:otherwise>
    										<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }" >
				    							<td>
				    								<a href="${path }/configFilter/modifyConfigFilter.action?configFilterVo.id=${configFilterVo.id }">${configFilterVo.sp_number }</a>
				    							</td>
				    							<td>${configFilterVo.num }</td>
				    							<td>${configFilterVo.start_time }</td>
				    							<td>${configFilterVo.end_time }</td>
				    							<td>
				    								<a href="javascript:removeConfigFilter(${configFilterVo.id },'${configFilterVo.province }','${configFilterVo.sp_number }');">删除</a>
				    							</td>
				    						</tr>
    									</c:otherwise>
    								</c:choose>
    							</c:forEach>
    						</c:if>
    					</c:forEach>
    				</c:when>
    				<c:otherwise>
    					<tr>
    						<td>暂无渠道扣量配置<td>
    					</tr>
    				</c:otherwise>
    			</c:choose>
    		</table>
    	</div>
    </div>
  </body>
</html>
